/*
 * To change this template, choose Tools | Templates and open the template in
 * the editor.
 */
package SteamEngineFX.util;
import SteamEngineFX.AppConst;
import javafx.scene.Scene;
import javafx.scene.effect.Lighting;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;

/**
 *
 * @author Jeff Bendixsen <jeff@westcoastcode.com>
 */
public class DialogFX extends Stage{
    
    public enum DialogType {
      INFO,
      ERROR
    }
    
    private DialogType dialogType = DialogType.INFO;
    
    private Scene scene = null;
    private VBox root = null;
    private Text promptText = null;
    
    public DialogFX(StageStyle ss) {
        super(ss);
        init();
    }

    public DialogFX() {
        init();
    }
    
    private void init(){
        
        root = new VBox();        
        
        scene = new Scene(root, 200, 100);
        scene.getStylesheets().addAll(AppConst.defaultStyleSheet);
        
        centerOnScreen();
        
        setTitle("Dialog");
        
        setScene(scene);
        
        
        promptText = new Text(20, 110, "JavaFX");
        promptText.setFill(Color.DODGERBLUE);
        promptText.setEffect(new Lighting());
        promptText.setFont(Font.font(Font.getDefault().getFamily(), 50));
      
        root.getChildren().add(promptText);
        
        initModality(Modality.APPLICATION_MODAL);
        
    }
    
    private void setPrompt(String prompt){
        promptText.setText(prompt);
    }
    
    public void ShowConfig(){
        show();
        
    }
    
    public void Show(DialogType dt, String prompt){
        
        this.dialogType = dt;
        switch(dt){
            case ERROR:
                setTitle("Error");
                break;
            case INFO:
                setTitle("Information");
                break;
            default:
                setTitle("Information");
                break;
        }
        setPrompt(prompt);
        show();
    }
    
    
}
